@isTest
private class iFulfillCurrentActCntrlrTest 
{
 /** 
 Manish Tiwari              v1.1   Class to cover the CurrentActController
 Bhumika Udani  3 Oct 2011  v1.2   improved coverage by including getDisableButton method 
 */
 
    static testMethod void myUnitTest() 
    {
     
       QueueSObject q = null;
        Profile p = [select id from profile where name='System Administrator'];                     
        User u = new User(alias = 'ipsyas', email='isadmin@accenture.com',emailencodingkey='UTF-8', lastname='TestUser', languagelocalekey='en_US',localesidkey='en_US', profileid = p.Id,timezonesidkey='Asia/Calcutta', username='ifulfilladmin@testorg.com');  
        Insert u;         
        System.runAs(u)
        {
   
               Group g = new Group(Type='Queue', Name='Queue name');
               insert g;
               system.debug('group idddddddddddd'+g.id);
               q = new QueueSObject(SobjectType='Fullfilment_Item__c', QueueId=g.Id);
               insert q;
        }  

     Workflow_Definition__c wd= New Workflow_Definition__c();
     wd.Workflow_Name__c='TestWorkflowDef';
     Insert wd;
     
     Workflow_Stage__c ws= new Workflow_Stage__c();
     ws.Name='TestWorkflowStageName';
     ws.Workflow_Code__c=wd.Id;
     Insert ws;
     
     Wokflow_Steps__c wrks= New Wokflow_Steps__c();
     wrks.Name='TestWorkflow';
     wrks.Target_Days__c=20;
     wrks.Wokflow_Stage_Name__c=ws.Id;
     Insert wrks;
     
     
     Fullfilment_Item__c fItem = New Fullfilment_Item__c();
     Fullfilment_Item__c fItem2 = New Fullfilment_Item__c();
    
     fItem.Current_Step__c=wrks.Id;
     fItem.ownerid = u.id;
     system.runAs(u){
     Insert fItem;
     }
     QueueSObject  qsobj = [select QueueId from QueueSObject  where id = :q.id ];
     fItem2.Current_Step__c=wrks.Id;
     fItem2.ownerId=qsobj.QueueId;
     insert fItem2;
                         
     FulFillment_Activities__c currentActs1= New FulFillment_Activities__c();
     FulFillment_Activities__c currentActs2= New FulFillment_Activities__c();
     FulFillment_Activities__c currentActs3= New FulFillment_Activities__c();

     currentActs1.Fullfilment_Item__c=fItem.Id;
     currentActs1.Wokflow_Steps__c=fItem.Current_Step__c;
     currentActs1.Completed_Date__c=Date.Today();
     currentActs1.Completed_By__c=u.Id;
     currentActs1.status__c='Not Complete';
         
          
     currentActs2.Fullfilment_Item__c=fItem.Id;
     currentActs2.Wokflow_Steps__c=fItem.Current_Step__c;
     currentActs2.Completed_Date__c=Date.Today();
     currentActs2.Completed_By__c=u.Id;
     currentActs2.status__c='Completed';
     
     currentActs3.Fullfilment_Item__c=fItem2.Id;
     currentActs3.Wokflow_Steps__c=fItem2.Current_Step__c;
     currentActs3.Completed_Date__c=Date.Today();
     currentActs3.Completed_By__c=u.Id;
     currentActs3.status__c='Not Complete';
           
     Insert currentActs1;
     Insert currentActs2;
     Insert currentActs3;     

     ApexPages.StandardController sc = new ApexPages.StandardController(fItem); 
     iFulfillCurrentActCntrlr  idc= New iFulfillCurrentActCntrlr (sc);
     idc.listactivities(); 
     idc.actWrap[0].selBox=True;
     idc.actWrap[0].FA=currentActs1;
     idc.doComplete();
     idc.getDisableButton(); 
     idc.listactivities();      
     idc.actWrap[1].selBox=True;
     idc.actWrap[1].FA=currentActs2;
     idc.doUnComplete();

     ApexPages.StandardController sc1 = new ApexPages.StandardController(fItem2); 
     iFulfillCurrentActCntrlr  idc1= New iFulfillCurrentActCntrlr (sc1);
     idc1.listactivities(); 
     idc1.actWrap[0].selBox=True;
     idc1.actWrap[0].FA=currentActs3;
     idc1.getDisableButton(); 
     

    
     
         
             


              
    }
}